package com.manner.groupon.controller.other;

import com.manner.groupon.common.BaseResponse;
import com.manner.groupon.service.other.FileService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author manner
 * @description 针对文件上传操作Controller
 * @createDate 2024-10-10 16:28:50
 */
@RestController
@RequestMapping("/file")
@RequiredArgsConstructor
    
public class FileController {

    @Resource
    private FileService fileService;

    @PostMapping("/upload")
    public BaseResponse<String> upload(MultipartFile file) {
        return fileService.upload(file);
    }

    @DeleteMapping
    public BaseResponse<String> delFile(String filePath) {
        return fileService.removeFile(filePath);
    }
}
